package com.xbongbong.pro.enums.raiders.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.pro.enums.HomeMenuEnum;
import com.xbongbong.pro.enums.menu.enums.ControlCenterMenuEnum;
import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

/**
 * 功能点 之 父级模块
 * @see RaidersPointChildEnum 父模块下的各个子模块枚举
 * @author zcp
 * @version v1.0
 * @date 19/9/21 021 17:11
 * @update 19/9/21 021 17:11
 * @since v1.0
 */
@Getter
public enum RaidersPointParentEnum {
    //【重要】确保父级应用模块的pointKey都为 xxx，即都在1000以下-确保不与RaidersPointChildEnum内的pointKey冲突

    /**
     * 依托于XbbRefTypeEnum
     */
    CRM(1, XbbRefTypeEnum.CRM.getAlias(), XbbRefTypeEnum.CRM.getI18nName(), 1, ProPermissionAliasEnum.CRM),
    PRODUCT(10, XbbRefTypeEnum.PRODUCT.getAlias(), XbbRefTypeEnum.PRODUCT.getI18nName(), 1, ProPermissionAliasEnum.PRODUCT_VIEW),
    FUND_MANAGEMENT(20, XbbRefTypeEnum.FUND_MANAGEMENT.getAlias(), XbbRefTypeEnum.FUND_MANAGEMENT.getI18nName(), 1, ProPermissionAliasEnum.FUND_MANAGEMENT),
    JXC(30, XbbRefTypeEnum.JXC.getAlias(), XbbRefTypeEnum.JXC.getI18nName(), 1, ProPermissionAliasEnum.JXC),
    WORK_ORDER(40, XbbRefTypeEnum.WORK_ORDER.getAlias(), XbbRefTypeEnum.WORK_ORDER.getI18nName(), 1, ProPermissionAliasEnum.WORK_ORDER_VIEW),

    /**
     * 依托于首页菜单枚举类：HomeMenuEnum
     */
    // 首页不需要权限，permission 置为 null
    HOME(51, HomeMenuEnum.HOME.getAlias(), HomeMenuEnum.HOME.getI18nName(), 2, null),
    CHART_CENTER(50, HomeMenuEnum.CHART_CENTER.getAlias(), HomeMenuEnum.CHART_CENTER.getI18nName(), 2, ProPermissionAliasEnum.CHART_VIEW),

    /**
     * 依托于管理中心列表枚举类：ControlCenterMenuEnum，该模块下的是应用
     */
    FORM_TEMPLATE(60, ControlCenterMenuEnum.FORM_TEMPLATE.getAlias(), ControlCenterMenuEnum.FORM_TEMPLATE.getI18nName(), 3, ProPermissionAliasEnum.FORM_SET_VIEW),

    PROCESS_SETTINGS(70, ControlCenterMenuEnum.PROCESS_SETTINGS.getAlias(), ControlCenterMenuEnum.PROCESS_SETTINGS.getI18nName(), 3, ProPermissionAliasEnum.PROCESS_SET_VIEW),

    ORGANIZATION_AUTHORITY(80, ControlCenterMenuEnum.ORGANIZATION_AUTHORITY.getAlias(), ControlCenterMenuEnum.ORGANIZATION_AUTHORITY.getI18nName(), 3, ProPermissionAliasEnum.ORGANIZATION_SET),

    ;

    /**
     * 枚举值 -- 攻略内所属pointKey
     */
    private final Integer pointKey;

    /**
     * 枚举值 -- 对应pro内的menu或app类型alias
     */
    private final String alias;
    /**
     * 枚举信息--中文名称
     */
    private final String name;

    /**
     * 枚举类型--1 XbbRefTypeEnum，2 HomeMenuEnum，3 ControlCenterMenuEnum
     *
     */
    private final Integer type;

    private final ProPermissionAliasEnum proPermissionAliasEnum;

    RaidersPointParentEnum(Integer pointKey, String alias, String name, int type, ProPermissionAliasEnum proPermissionAliasEnum) {
        this.pointKey = pointKey;
        this.alias = alias;
        this.name = name;
        this.type = type;
        this.proPermissionAliasEnum = proPermissionAliasEnum;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
